import http from "./htttp";
export const getLocation = function () {
    return new Promise((res, rej) => {
        new BMap.Geolocation().getCurrentPosition((position) => {
            http("/getlocation", {
                params: {
                    x: position.point.lat,
                    y: position.point.lng,
                },
            }).then((data) =>
                res(data.data.datas)
            );
        });
    });
}

export const getCityId = function (name) {
    return new Promise((res, rej) => {
        http("/getcitylists").then((data) => {
            res({
                cityId: data.data.cities.filter((city) => city.name == name)[0]
                    .cityId,
                origin: data.data.cities,
            });
        });
    });
}

